﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DynaPrecision.LinearSystem
{
	public class VectorBasedColumnArray<TVector, T> : IMultiDimensionalArray<T>
		where TVector : IVector<T>
	{

		public TVector UnderlyingVector { get; set; }
		#region IMultiDimensionalArray<T> Members

		public T this[params int[] index]
		{
			get
			{
				return UnderlyingVector[index[0]];
			}
			set
			{
				UnderlyingVector[index[0]] = value;
			}
		}

		public int GetLength(int DimensinNumber)
		{
			if (DimensinNumber == 0) return UnderlyingVector.Count;
			else if (DimensinNumber == 1) return 1;
			else return 0;
		}

		public int Dimension
		{
			get { return 2; }
		}

		#endregion

		public static explicit operator VectorBasedColumnArray<TVector, T>(TVector vector)
		{
			return new VectorBasedColumnArray<TVector, T> { UnderlyingVector = vector };
		}
	}
}
